import React, { useCallback } from "react";
import { useHistory } from "react-router-dom";
import "../style.scss";
export default function Tab({ onAddCart, onBuy }) {
    // console.log(onAddCart,onBuy);
    const history = useHistory();
    const goCart = useCallback(() => {
        history.push("/cart");
    }, [history]);
   
    return (
        <div className="tab">
            <div className="iconfont icon-fenxiang"></div>
            <div className="iconfont icon-icon-" onClick={goCart}></div>
            <div className="btn add" onClick={onAddCart}>
                加入购物车
            </div>
            <div className="btn buy" onClick={onBuy}>
                立即购买
            </div>
        </div>
    );
}
